package service.impl;

import bean.dto.EquipmentPage;
import bean.pojo.ComplaintRecord;
import bean.pojo.Maintenance;
import dao.ComplaintRecordDao;
import dao.EquipmentMaintenanceDao;
import dao.impl.ComplaintRecordDaoImpl;
import dao.impl.EquipmentMaintenanceDaoImpl;
import service.ComplaintRecordService;

import java.util.List;

/**
 * service.impl
 * User: xlh
 * Date: 2024/12/21 15:27
 * motto:推到高塔
 * Description:
 * Version: V1.0
 */
public class ComplaintRecordServiceImpl implements ComplaintRecordService {
    ComplaintRecordDao complaintRecordDao=new ComplaintRecordDaoImpl();
    @Override
    public List<ComplaintRecord> findByPage(EquipmentPage equipmentPage) {
        return complaintRecordDao.findByPage(equipmentPage);
    }

    @Override
    public boolean updatComplaintRecord(ComplaintRecord complaintRecord) {
        return complaintRecordDao.updatComplaintRecord(complaintRecord);
    }

    @Override
    public boolean createComplaintRecord(ComplaintRecord complaintRecord) {
        return complaintRecordDao.createComplaintRecord(complaintRecord);
    }

    @Override
    public Long findByTotal(EquipmentPage equipmentPage) {
        //验证有没有值
        if(equipmentPage.getSelectMonth()==null  ||  equipmentPage.getSelectMonth().trim().length()==0){
            equipmentPage.setSelectMonth(null);
        }
        if(equipmentPage.getSelectedStatus()==null  ||  equipmentPage.getSelectedStatus().trim().length()==0){
            equipmentPage.setSelectedStatus(null);
        }
        return   complaintRecordDao.findByTotal(equipmentPage);
    }
}
